package com.epfly.promo.activity.dao;

import com.epfly.promo.activity.entity.ActivityFoodEntity;
import org.apache.ibatis.annotations.*;
import tk.mybatis.mapper.additional.insert.InsertListMapper;
import tk.mybatis.mapper.common.BaseMapper;

import java.util.List;

@Mapper
public interface ActivityFoodMapper extends BaseMapper<ActivityFoodEntity>, InsertListMapper<ActivityFoodEntity> {


    @Delete(value = "delete from tbl_activity_food where activity_id = #{activityId} and del_flag = 0 ")
    int deleteByActivityId(@Param(value = "activityId") Long activityId);

    @ResultMap(value = "activityFoodMapperBaseResultMap")
    @Select(value = "select relation_id from tbl_activity_food where activity_id = #{activityId} and del_flag = 0  ")
    List<ActivityFoodEntity> findByActivityId(@Param(value = "activityId") Long activityId);

    ActivityFoodEntity existsByActivityIdAndFoodIdList(@Param(value = "activityId") Long activityId, @Param(value = "foodIdList") List<String> foodIdList);

    List<String> findByActivityIdAndFoodIdList(@Param(value = "activityId") Long activityId, @Param(value = "foodIdList") List<String> foodIdList);
}
